package com.morehair.controller.wx;

import com.morehair.bean.vo.admin.BaseRespVo;
import com.morehair.bean.vo.wx.WxSearchVo;
import com.morehair.service.wx.WxSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Author  kkw
 * Date  2021/6/9 11:08
 * Version 1.0
 * Description :
 */
@RestController
@RequestMapping("wx/search")
public class WxSearchController {
    @Autowired
    WxSearchService wxSearchService;

    @GetMapping("index")
    public BaseRespVo getSearch() {
        WxSearchVo wxSearchVo = wxSearchService.getSearch();
        return BaseRespVo.ok(wxSearchVo);
    }

    @GetMapping("helper")
    public BaseRespVo getHelper(String keyword) {
        List<String> keywordResult=wxSearchService.getKeyword(keyword);
        return BaseRespVo.ok(keywordResult);
    }

    @PostMapping("clearhistory")
    public BaseRespVo clearHistory() {
        wxSearchService.clearHistory();
        return BaseRespVo.ok();
    }


}
